""" 
@coding  : utf-8
@Time    : 2023/5/31 21:40
@Author  : Rumou
@File    : 验证ipv4地址合法性.py
@Description: 
"""
import re

# 验证ipv4地址合法性
# 1~255.1~255.1~255.1~255
ipv4 = input("请输入:")
check_ip = re.findall(
    r'^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.'
    r'(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$', ipv4)
if check_ip:
    print("true")
else:
    print("false")
